layui.use(['form','jquery','table','layer'],function() {
    let form = layui.form,
        $ = layui.jquery,
        table = layui.table,
        layer = layui.layer;

    //加载数据表格
    let tabInstance = table.render({
        elem: '#lossAnalyze',
        url: '/customer-loss/list', //数据接口
        page: true, //开启分页
        limit: 2, //每页显示的条数，默认10
        limits: [2, 5, 10, 15,], //每页显示条数选择框数据
        cols: [[ //表头
            {field: 'id', title: '编号', width: 80, sort: true, align: "center"},
            {field: 'customerName', title: '客户', align: "center"},
            {field: 'customerMgr', title: '客户经理', align: "center"},
            {field: 'lossTime', title: '流失时间', align: "center"},
            {field: 'lossReason', title: '流失原因', align: "center"},
        ]]
    });

    //搜索监听启用
    form.on('submit(search)', function (data) {
        tabInstance.reload({
            where: data.field
        });
        return false;
    });
})